	//Focus 焦点
	var Item=function(selector){
		this.selector=selector;
		this.element=$(selector).get(0);
	};
	var List=function(selector){
		Item.call(this,selector)
	};
	
	
	var Focus=function(selector){
		Item.call(this,selector)
		//console.log(selector);
	}
	Focus.prototype=new Control();
	Focus.prototype.focusNum=0;
	Focus.prototype.total=0;
	Focus.prototype.focusList=new Array();
	Focus.prototype.init=function(){
		this.create();
		this.focusList=new FocusList(this.element.children[0].children[0]);
		this.total=this.focusList.total;
		
		var self=this;
		$(".prevButton",this.selector).bind("click",function(event){
			self.prev();
		})
		$(".nextButton",this.selector).bind("click",function(event){
			self.next();
		})
		
		var container=$(".container",this.selector).get(0);
		var self=this;
		var startX=0;
		var startY=0;
		var touchX=0;
		
		$(container).bind("touchstart",function(event){
			//console.log("touchstart");
			var touch = event.originalEvent.touches[0], //获取第一个触点
				x = Number(touch.pageX), //页面触点X坐标
				y = Number(touch.pageY); //页面触点Y坐标
			//记录触点初始位置
			startX = x;
			startY = y;
		})
		$(container).bind("touchmove",function(event){
			var uWidth=document.body.clientWidth;
			var touch = event.originalEvent.touches[0]; //获取第一个触点
				x = Number(touch.pageX); //页面触点X坐标
				y = Number(touch.pageY); //页面触点Y坐标
				
			touchX=x - startX;
			var left=-(self.focusNum*uWidth)+touchX;
			//console.log(left);
			if(left<0 && left>-$("ul",self.selector).width()-uWidth){
				$("ul",self.selector).css({"left":left+"px"});
			}
		})
		$(container).bind("touchend",function(event){
			//console.log("touchEnd");
			//console.log(touchX);
			if(touchX>100){
				self.prev();
			}else if(touchX<-100){
				self.next();
			}else{
				self.setFocusNum(self.focusNum);
			}
		})
	}
	Focus.prototype.create=function(){
		var ul=$(this.selector).children(0);
		//var html="<div class=\"container\"></div><a class=\"prevButton\">prev</a><a class=\"nextButton\">next</a>"
		var html="<div class=\"container\"></div><a class=\"prevButton\">prev</a><a class=\"nextButton\">next</a>"
		$(this.selector).append(html)
		$(".container",this.selector).append(ul)
	}
	Focus.prototype.setFocusNum=function(focusNum){
		this.focusNum=focusNum;
		this.focusList.setFocusNum(this.focusNum);
	}
	Focus.prototype.prev=function(){
		//console.log("prev");
		if(this.focusNum>0){
			this.focusNum--;
		}else{
			this.focusNum=this.total-1;
		}
		this.setFocusNum(this.focusNum);
	}
	Focus.prototype.next=function(){
		//console.log("next");
		if(this.focusNum<this.total-1){
			this.focusNum++;
		}else{
			this.focusNum=0;
		}
		this.setFocusNum(this.focusNum);
	}
	
	
	
	
	
	
	
	FocusList=function(selector){
		List.call(this,selector)
		this.init();
	}
	FocusList.prototype.focusNum=0;
	FocusList.prototype.total=0;
	FocusList.prototype.itemList=new Array();
	FocusList.prototype.init=function(){
		this.create();
	}
	FocusList.prototype.create=function(){
		var children=this.element.children;
		this.total=children.length;
		for(var i=0;i<this.total;i++){
			this.itemList[i]=new FocusListItem(children[i]);
		}
	}
	FocusList.prototype.setFocusNum=function(focusNum){
		this.focusNum=focusNum;
		//console.log(this.focusNum);
		var uWidth=document.body.clientWidth;
		
		var left=-(focusNum*uWidth);
		$(this.element).animate({left:left+"px"});
		for(var i=0;i<this.total;i++){
			this.itemList[i].focusClose();
		}
		this.itemList[focusNum].focusOpen();
	}
	
	
	
	
	
	
	
	
	
	FocusListItem=function(selector){
		Item.call(this,selector)
	}
	FocusListItem.prototype.init=function(){}
	FocusListItem.prototype.update=function(){
	}
	FocusListItem.prototype.focusOpen=function(){
		this.element.className="focusOpen"
	}
	FocusListItem.prototype.focusClose=function(){
		this.element.className="focusClose"
	}
	HTMLTurbo.control.Focus=Focus;